package com.dyh.quickdemo.bizDemo.syncShop;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Setter;
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.UnaryOperator;

/*
@Author=Joey Wheeler
@Date=2020/11/23 10:50
*/
public class SyncShop {

    @Data@AllArgsConstructor
    class Shop{
        String code;
    }

    @Data@AllArgsConstructor
    class CustomerMapping{
        String customerCode;
    }

    @Data
    class Req{
        String shopCode;
        String customerCode;
    }

    BiConsumer<Shop,Req> fillByShop = (shop, req) -> {
        req.setShopCode(shop.getCode());
    };

    BiConsumer<CustomerMapping,Req> fillByCustomerMapping = (customerMapping, req) -> {
        req.setCustomerCode(customerMapping.getCustomerCode());
    };


    @Test
    public void test(){
        Req req = new Req();
        Shop shop = new Shop("114");
        CustomerMapping customerMapping = new CustomerMapping("364");

        fillByShop.accept(shop,req);
        fillByCustomerMapping.accept(customerMapping,req);

    }

    @Test
    public void test1(){
//        List<String> lists = new ArrayList<>();
//        while (lists.size()<3){
//            lists.add("");
//        }

        List<String> lists = Lists.newArrayList("");

                while (lists.size()<3){
            lists.add("");
        }
        System.out.println();

        //UnaryOperator.identity().andThen();
    }

}
